<%@ page language="java" pageEncoding="UTF-8" contentType="text/html;charset=utf-8" %>
<%@ include file="/taglibs.jsp" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib uri="http://displaytag.sf.net/el" prefix="display"%>
<html>
<head>
    <title>商品详情</title>
    <style>
        #img-container {
            width: 100%;
        }
        #comment-conatainer {
            width: 100%;
        }
    </style>
</head>
<body>
    <div id="img-container">
        <display:table name="list"
                       requestURI="list.html" class="list"
                       id="row" cellspacing="0" cellpadding="0">
            <display:column title="古玩名称" property="productName"/>
            <display:column title="正面">
                <img style="width:100px;" src="${ctx}/${row.productPic1}"/>
            </display:column>
            <display:column title="侧面">
                <img style="width:100px;" src="${ctx}/${row.productPic2}"/>
            </display:column>
            <display:column title="上面">
                <img style="width:100px;" src="${ctx}/${row.productPic3}"/>
            </display:column>
            <display:column title="底面">
                <img style="width:100px;" src="${ctx}/${row.productPic4}"/>
            </display:column>.
            <display:column title="内容" property="content"/>
            <display:column title="专家鉴定意见" property="comments"/>
            <display:column title="标价" property="price"/>
            <display:column title="是否卖出" property="sellStatus"/>
            <display:column title="状态" property="status"/>
            <display:column title="分类" property="typesName"/>
            <display:column title="购买" style="width:40px;">
        </display:table>
    </div>
    <div id="comment-conatainer">
        <display:table name="commentList"
                       requestURI="list.html" class="list"
                       id="row" cellspacing="0" cellpadding="0">
            <display:column title="古玩名称" property="productName"/>
            <display:column title="正面">
                <img style="width:100px;" src="${ctx}/${row.productPic1}"/>
            </display:column>
            <display:column title="侧面">
                <img style="width:100px;" src="${ctx}/${row.productPic2}"/>
            </display:column>
        </display:table>
    </div>
    <script>
        function save() {
            if (document.getElementById("comment").value == null || document.getElementById("comment").value === "") {
                alert("请填写评论");
            }
            $.post("commentAdd.html",{productId: ${productId}, content: document.getElementById("comment").value},
                function(result){
                    result = eval("("+result+")");
                    if(result.status == "true" || result.status == true){
                        alert('成功');
                        window.location.href = 'detail.html?productId=${productId}';
                    }else{
                        alert('保存失败，请重试');
                    }
                }
            );
        }
    </script>
    <div id="add-comment-container">
        <textarea id="comment"></textarea>
        <button onclick="addComment">提交</button>
    </div>
</body>
</html>
